<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>小米6立即购买-小米商城</title>
		<link rel="stylesheet" type="text/css" href="./css/style.css">
		<script src="js/jquery-3.5.1.js" type="application/javascript"></script>
		<script src="js/js.cookie.js" type="application/javascript"></script>
		<script type="text/javascript">
			var a=null;
			$(document).ready(function () {
				$.ajax({
					type: "post",
					dataType: "json",
					url: "GetLoginInfoController",
					success: function (data) {
						//alert(data.result);
						if (data.result != "0") {
							a=data.result;
							$("#current_user").empty();
							var str= "<ul>"
									+"<li><a href='self_info' target='_blank'>"+data.result+"</a></li>"
									+"<li>|</li>"
									+"<li><a href='order_center'>订单通知</a></li>"
									+"</ul>";
							$("#current_user").append(str);
						}  else {
							var url = "login";
							Cookies.remove('login_name');
							Cookies.remove('login_pwd');
							location.href = encodeURI(url
									+ "?tip=");
						}
					},
					error: function (XMLHttpRequest, textStatus, errorThrown) {
						// 状态码
						console.log(XMLHttpRequest.status);
						// 状态
						console.log(XMLHttpRequest.readyState);
						// 错误信息
						console.log(textStatus);
					}
				});
			});
			var data=null;
		$(function(){
			var urlParam = window.location.search;//截取当前url中"?"后面的字符串
			urlParam = decodeURI(urlParam, "UTF-8");//可以用来把字符还原回来
			var productname = urlParam.substring(urlParam.lastIndexOf('=') + 1,
					urlParam.length);
			$.ajax({
				type:"post",
				dataType:"json",
				url:"ProductDetailController",
				data:{
					"productname":productname
				},
				success:function (msg) {
					data=msg.productInfo;
					$("#jieshao").empty();
					var str="<div class='left fl'><img src='./image/liebiao_xiaomi6.jpg'></div>"
							+"<div class='right fr'>"
							+"<div class='h3 ml20 mt20'>"+data.productname+"</div>"
							+"<div class='jianjie mr40 ml20 mt10'>"+data.characteristics+"</div>"
					+"<div class='jiage ml20 mt10'>"+data.price+"</div>"
					+"<div class='ft20 ml20 mt20'>选择版本</div>"
							+"<div class='xzbb ml20 mt10'>"
							+"<div class='banben fl'>"
							+"<a>"
							+"<span>"+data.kind+" </span>"
					+"<span>"+data.price+"</span>"
					+"</a>"
					+"</div>"
					+"<div class='banben fr'>"
							+"<a>"
							+"<span>全网通版 6GB+128GB</span>"
					+"<span>"+data.price+"</span>"
					+"</a>"
					+"</div>"
					+"<div class='clear'></div>"
							+"</div>"
							+"<div class='ft20 ml20 mt20'>选择颜色</div>"
							+"<div class='xzbb ml20 mt10'>"
							+"<div class='banben'>"
							+"<a>"
							+"<span class='yuandian'></span>"
							+"<span class='yanse'>"+data.color+"</span>"
							+"</a>"
							+"</div>"

							+"</div>"
							+"<div class='xqxq mt20 ml20'>"
							+"<div class='top1 mt10'>"
							+"<div class='left1 fl'>"+data.productname+" "+data.color+"</div>"
					+"<div class='right1 fr'>2499.00元</div>"
					+"<div class='clear'></div>"
							+"</div>"
							+"<div class='bot mt20 ft20 ftbc'>总计：2499元</div>"
					+"</div>"
					+"<div class='xiadan ml20 mt20'>"
							+"<input class='jrgwc'  type='button' name='jrgwc' onclick='Corder()' value='立即选购' />"
							+"<input class='jrgwc' type='button' name='jrgwc' onclick='Ccart()' value='加入购物车' />"

							+"</div>"
							+"</div>"
							+"<div class='clear'></div>";
					$("#jieshao").append(str);
				}

			})
		})
			function Corder() {
				var order_product=data.productname;
				var order_user=a;
				var orderid=parseInt((Math.random()*9+1)*100000);
				var status="未发货"
				var now=new Date();
				var date=now.toLocaleDateString()+" "+now.getHours()+":"+now.getMinutes()+":"+now.getSeconds();
				addOrder(order_product,order_user,orderid,status,date);
			}

			function addOrder(order_product,order_user,orderid,status,date) {
				$.ajax({
					type:"post",
					dateType:"json",
					url: "AddOController",
					data:{
						"pname":order_product,
						"uname":order_user,
						 "orderid":orderid,
						 "isout":status,
						 "riqi":date
					},
					success:function (data) {
						if(data.result=="1"){
							location.href("order_center");
						}
					}
				});
			}
			function Ccart() {
				var cart_product=data.productname;
				var cart_user=a;

				addCart(cart_product,cart_user);
			}
			function addCart(cart_product,cart_user) {
			alert("aaa");
				$.ajax({
					type:"post",
					dataType:"json",
					url:"AddCartController",
					data:{
						"productname":cart_product,
						"username":cart_user
					},
					success:function (data) {
						if(data.result=="1"){
							location.href="shopping_cart";
						}
					}
				});
			}
		</script>
	</head>
	<body>
	<!-- start header -->
		<header>
			<div class="top center">
				<div class="left fl">
					<ul>
						<li><a href="index" target="_blank">小米商城</a></li>
						<li>|</li>
						<li><a href="">MIUI</a></li>
						<li>|</li>
						<li><a href="">米聊</a></li>
						<li>|</li>
						<li><a href="">游戏</a></li>
						<li>|</li>
						<li><a href="">多看阅读</a></li>
						<li>|</li>
						<li><a href="">云服务</a></li>
						<li>|</li>
						<li><a href="">金融</a></li>
						<li>|</li>
						<li><a href="">小米商城移动版</a></li>
						<li>|</li>
						<li><a href="">问题反馈</a></li>
						<li>|</li>
						<li><a href="">Select Region</a></li>
						<div class="clear"></div>
					</ul>
				</div>
				<div class="right fr">
					<div class="gouwuche fr"><a href="shopping_cart">购物车</a></div>
					<div class="fr" id="current_user">
						<ul>
							<li><a href="login" target="_blank">登录</a></li>
							<li>|</li>
							<li><a href="register" target="_blank" >注册</a></li>
							<li>|</li>
							<li><a href="">消息通知</a></li>
						</ul>
					</div>
					<div class="clear"></div>
				</div>
				<div class="clear"></div>
			</div>
		</header>
	<!--end header -->

<!-- start banner_x -->
		<div class="banner_x center">
			<a href="./index.html" target="_blank"><div class="logo fl"></div></a>
			<a href=""><div class="ad_top fl"></div></a>
			<div class="nav fl">
				<ul>
					<li><a href="">小米手机</a></li>
					<li><a href="">红米</a></li>
					<li><a href="">平板·笔记本</a></li>
					<li><a href="">电视</a></li>
					<li><a href="">盒子·影音</a></li>
					<li><a href="">路由器</a></li>
					<li><a href="">智能硬件</a></li>
					<li><a href="">服务</a></li>
					<li><a href="">社区</a></li>
				</ul>
			</div>
			<div class="search fr">
				<form action="" method="post">
					<div class="text fl">
						<input type="text" class="shuru"  placeholder="小米6&nbsp;小米MIX现货">
					</div>
					<div class="submit fl">
						<input type="submit" class="sousuo" value="搜索"/>
					</div>
					<div class="clear"></div>
				</form>
				<div class="clear"></div>
			</div>
		</div>
<!-- end banner_x -->

	
	<!-- xiangqing -->
	<form action="post" method="">
	<div class="xiangqing">
		<div class="neirong w">
			<div class="xiaomi6 fl">小米6</div>
			<nav class="fr">
				<li><a href="">概述</a></li>
				<li>|</li>
				<li><a href="">变焦双摄</a></li>
				<li>|</li>
				<li><a href="">设计</a></li>
				<li>|</li>
				<li><a href="">参数</a></li>
				<li>|</li>
				<li><a href="">F码通道</a></li>
				<li>|</li>
				<li><a href="">用户评价</a></li>
				<div class="clear"></div>
			</nav>
			<div class="clear"></div>
		</div>	
	</div>
	
	<div class="jieshao mt20 w" id="jieshao">
<!--		<div class="left fl"><img src="./image/liebiao_xiaomi6.jpg"></div>-->
<!--		<div class="right fr">-->
<!--			<div class="h3 ml20 mt20">小米6</div>-->
<!--			<div class="jianjie mr40 ml20 mt10">变焦双摄，4 轴防抖 / 骁龙835 旗舰处理器，6GB 大内存，最大可选128GB 闪存 / 5.15" 护眼屏 / 四曲面玻璃/陶瓷机身</div>-->
<!--			<div class="jiage ml20 mt10">2499.00元</div>-->
<!--			<div class="ft20 ml20 mt20">选择版本</div>-->
<!--			<div class="xzbb ml20 mt10">-->
<!--				<div class="banben fl">-->
<!--					<a>-->
<!--						<span>全网通版 6GB+64GB </span>-->
<!--						<span>2499元</span>-->
<!--					</a>-->
<!--				</div>-->
<!--				<div class="banben fr">-->
<!--					<a>-->
<!--						<span>全网通版 6GB+128GB</span>-->
<!--						<span>2899元</span>-->
<!--					</a>-->
<!--				</div>-->
<!--				<div class="clear"></div>-->
<!--			</div>-->
<!--			<div class="ft20 ml20 mt20">选择颜色</div>-->
<!--			<div class="xzbb ml20 mt10">-->
<!--				<div class="banben">-->
<!--					<a>-->
<!--						<span class="yuandian"></span>-->
<!--						<span class="yanse">亮黑色</span>-->
<!--					</a>-->
<!--				</div>-->
<!--				-->
<!--			</div>-->
<!--			<div class="xqxq mt20 ml20">-->
<!--				<div class="top1 mt10">-->
<!--					<div class="left1 fl">小米6 全网通版 6GB内存 64GB 亮黑色</div>-->
<!--					<div class="right1 fr">2499.00元</div>-->
<!--					<div class="clear"></div>-->
<!--				</div>-->
<!--				<div class="bot mt20 ft20 ftbc">总计：2499元</div>-->
<!--			</div>-->
<!--			<div class="xiadan ml20 mt20">-->
<!--					<input class="jrgwc"  type="button" name="jrgwc" value="立即选购" />-->
<!--					<input class="jrgwc" type="button" name="jrgwc" value="加入购物车" />-->
<!--				-->
<!--			</div>-->
<!--		</div>-->
<!--		<div class="clear"></div>-->
	</div>
	</form>
	<!-- footer -->
	<footer class="mt20 center">
			
			<div class="mt20">小米商城|MIUI|米聊|多看书城|小米路由器|视频电话|小米天猫店|小米淘宝直营店|小米网盟|小米移动|隐私政策|Select Region</div>
			<div>©mi.com 京ICP证110507号 京ICP备10046444号 京公网安备11010802020134号 京网文[2014]0059-0009号</div> 
			<div>违法和不良信息举报电话：185-0130-1238，本网站所列数据，除特殊说明，所有数据均出自我司实验室测试</div>

		</footer>

	</body>
</html>